package com.qding.park.common.core.exceptions.system;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import com.qding.park.common.core.exceptions.BaseException;
import com.qding.park.common.core.exceptions.ExceptionMessage;
import com.qding.park.common.core.exceptions.ModularEnum;

public class NetWorkException extends BaseException {
	
	
	public static enum TypeEnum {
		
		EXCEPTION_NETWORK(ModularEnum.MODULAR_SYSTEM.getId() + ".0001", "网络通信异常");

		private String id;

		private String desc;

		private TypeEnum(String id, String desc) {
			this.id = id;
			this.desc = desc;
		}

		public String getId() {
			return id;
		}

		public void setId(String id) {
			this.id = id;
		}

		public String getDesc() {
			return desc;
		}

		public void setDesc(String desc) {
			this.desc = desc;
		}

	}

	private static final Log _log = LogFactory.getLog(NetWorkException.class);
//	private Exception ex;

	private ExceptionMessage exceptionMessage;

	public NetWorkException(String id, Exception ex, ExceptionMessage exceptionMessage) {
		super(id, ex, null);
		this.exceptionMessage = exceptionMessage;
	}

	public void handle() {
		_log.error("NetWorkException Context::"+this.exceptionMessage);
		super.handle();
	}

	/**
	 * @Field @serialVersionUID : TODO(这里用一句话描述这个类的作用)
	 */
	private static final long serialVersionUID = 1L;

//	public Exception getEx() {
//		return ex;
//	}
//
//	public void setEx(Exception ex) {
//		this.ex = ex;
//	}

	public ExceptionMessage getExceptionMessage() {
		return exceptionMessage;
	}

	public void setExceptionMessage(ExceptionMessage exceptionMessage) {
		this.exceptionMessage = exceptionMessage;
	}

}
